#!/bin/ksh
#
# Written by:  Chuck Spilman				06/24/2001
#
# Description:
#   Shows the temperatures for all SSA enclosures.
#

function display
{
   if [ ${#} -eq 3 ]
   then
     printf "%-25s %-20s %s " "${1}" "${2}" "${3}"
   else
     echo "${*}"
   fi
}

function check_temp
{

ITEM="${1}"

display "Checking temperature" "${ITEM}" "..."
  /usr/sbin/ssaencl -al ${ITEM} | grep temperature | awk '{print $2}' | read TEMP
  ((TEMP=TEMP*9/5+32))
  display "${TEMP}"
}

for ENCLOSURE in $(lscfg | grep enclosure | awk '{print $2}' | sort)
do
  check_temp ${ENCLOSURE}
done
